package day09_modi.demo14_Peptides;

public class Animal {
    private int age;
    private String name;
    private String sex;
    private String kind;
    private int health=60;//健康值
    private int sum=60;//饱食度
    public void eat(){
        System.out.println("动物吃东西");
    }
    public Animal() {
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getKind() {
        return kind;
    }

    public void setKind(String kind) {
        this.kind = kind;
    }

    public int getHealth() {
        return health;
    }

    public void setHealth(int health) {//0-100
        if(health>=0&&health<=100){
            this.health = health;
        }else if(health>=100){
            this.health=100;
        }else if(health<0){
            this.health=0;
            System.out.println("宠物挂了");
        }
    }

    public int getSum() {
        return sum;
    }

    public void setSum(int sum) {
        if (sum>0&&sum<=100){
            this.sum = sum;
        }else if (sum<=0){
            this.sum=0;
            System.out.println("宠物挂了");
        }else if (sum>=100){
            this.sum=0;
            System.out.println("宠物挂了");
        }
    }

    public Animal(int age, String name, String sex, String kind) {
        this.age = age;
        this.name = name;
        this.sex = sex;
        this.kind = kind;
    }
}
